<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2024/3/21
 * Time: 17:49
 */

namespace app\model\user;


use app\model\BaseModel;

class UserLoginRecordModel extends BaseModel
{
    protected $table = 'video_user_login_record';

    protected $primaryKey = 'loginid';

    public $timestamps = false;

    protected static $instance;

    public static function getInstance()
    {
        //        if(is_object(self::$instance)){
//            return self::$instance;
//        }

        return new self();
    }

    public function insertData($param)
    {
        $insert = [
            'user_sn'=> $param['user_sn']??'',
            'nickname'=> $param['nickname']??'',
            'login_ip'=> request()->getRealIp(),
            'token'=> $param['token']??'',
            'token_md5'=> md5($param['token']??''),
            'uuid'=> request()->uuid??'',
        ];

        return $this->insertGetId($insert);
    }
}